class myScreen extends WindowBase {
	public constructor() {
		super();
	}
	private closeBtn: eui.Button;
	private scroller: eui.Scroller;
	private list: eui.List;

	protected startLoad(): void {
		this.skinName = "resource/skin/myScreenSkin.exml";
	}

	protected loaded(): void {
		this.scroller.viewport = this.list;
	}

	protected show(): void {
		this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.close, this);
		App.event.addEventListener(GameEvent.RENDER_LIST, this.render, this);
		SocketIo.getInstance().request("reqList", 6);
	}

	protected hide(): void {
		this.closeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.close, this);
		App.event.removeEventListener(GameEvent.RENDER_LIST, this.render, this);
	}

	private render(evt: GameEvent): void {
		let data = evt.data;
		let arrData = [];
		let arr: any[] = data.data;
		arr.forEach((v, i, arr) => {
			if (v) {
				let o = { label: v.num }
				arrData.push(o);
			}
		}, this);
		this.list.dataProvider = new eui.ArrayCollection(arrData);
	}

}